home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_hash.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  2KB  |  38 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4. import unittest
  5. from test import test_support
  6.  
  7. class HashEqualityTestCase(unittest.TestCase):
  8.     
  9.     def same_hash(self, *objlist):
  10.         hashed = map(hash, objlist)
  11.         for h in hashed[1:]:
  12.             if h != hashed[0]:
  13.                 self.fail('hashed values differ: %r' % (objlist,))
  14.                 continue
  15.         
  16.  
  17.     
  18.     def test_numeric_literals(self):
  19.         self.same_hash(1, 0x1L, 1.0, 1.0 + (0.0+0.0j))
  20.  
  21.     
  22.     def test_coerced_integers(self):
  23.         self.same_hash(int(1), long(1), float(1), complex(1), int('1'), float('1.0'))
  24.  
  25.     
  26.     def test_coerced_floats(self):
  27.         self.same_hash(long(1.2299999999999999e+300), float(1.2299999999999999e+300))
  28.         self.same_hash(float(0.5), complex(0.5, 0.0))
  29.  
  30.  
  31.  
  32. def test_main():
  33.     test_support.run_unittest(HashEqualityTestCase)
  34.  
  35. if __name__ == '__main__':
  36.     test_main()
  37.  
  38.